USE [BMIG_Mensual_POST_CADENA]
GO

/****** Object:  StoredProcedure [dbo].[WASP_M0002_LIMPIA_TABLAS]    Script Date: 11/24/2011 14:33:15 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WASP_M0002_LIMPIA_TABLAS]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[WASP_M0002_LIMPIA_TABLAS]
GO

USE [BMIG_Mensual_POST_CADENA]
GO

/****** Object:  StoredProcedure [dbo].[WASP_M0002_LIMPIA_TABLAS]    Script Date: 11/24/2011 14:33:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[WASP_M0002_LIMPIA_TABLAS]
AS
BEGIN
    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[MaestroCredito]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [MaestroCredito]
    
    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[tipo_credito_mc]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE dbo.[tipo_credito_mc]
    
    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[notaria]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [notaria]
    
    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[codeudores]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [codeudores]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[valor_cuota]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [valor_cuota]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[comisiones]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [comisiones]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[ult_pa]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [ult_pa]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[seguro_degrav]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [seguro_degrav]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[seguro_ces]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [seguro_ces]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[impuesto]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [dbo].[impuesto]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[seguro]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [seguro]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[mora]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [mora]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[diasprim]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [diasprim]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[CSPF000_TEMP]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [dbo].[CSPF000_TEMP]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[rut_emp]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [rut_emp]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[cragencia]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [cragencia]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[valores_seguros]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [valores_seguros]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[codis_seguros]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [codis_seguros]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[seguros]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [seguros]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[seguro_asisten_pen]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [seguro_asisten_pen]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[seguro_vida_tra]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [seguro_vida_tra]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[crseguros]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [crseguros]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[clave_emp]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [clave_emp]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[endeuda_maximo]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [endeuda_maximo]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[est_trabajador]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [est_trabajador]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[monto_liq]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [monto_liq]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[as_refundidos]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE [as_refundidos]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[as_solicitante]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE dbo.[as_solicitante]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[vigente]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE dbo.[vigente]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[seguro_degr]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE dbo.[seguro_degr]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[base_clave]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE dbo.[base_clave]

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[seguro_salud]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
      DROP TABLE dbo.[seguro_salud]
END

GO


